import Axios from "axios";
import NProgress from 'nprogress'


var axios = Axios.create({
     // axios中请求配置有baseURL选项，表示请求URL公共部分
    baseURL: "http://127.0.0.1:8888/api/private/v1/",
     // 超时
    timeout: 10000
});

//request拦截器
axios.interceptors.request.use(config => {
    NProgress.start();
    // NProgress.start();
    // 添加token
    config.headers.Authorization = window.sessionStorage.getItem('token');
    return config;
});


axios.interceptors.response.use(confirm => {
    NProgress.done();
    return confirm;
})

export default axios;

